<?php

class Adept_Component_Message extends Adept_Component_Base
{
    protected $for;
    protected $group = null;

    public function getMessage()
    {
        $form = $this->findParentByClass('Adept_Component_Form');
        $groupId = !is_null($this->group) ? $this->group : (!is_null($form) ? $form->getId() : '');
        
        $id = !is_null($this->for) ? $this->for : $this->getId();
        
        $message = Adept_MessageSet::getInstance()->getMessage($id, $groupId);
        return $message;
    }

    public function getFor() 
    {
        return $this->for;
    }
    
    public function setFor($for) 
    {
        $this->for = $for;
    }
    
    public function getGroup() 
    {
        return $this->group;
    }
    
    public function setGroup($group) 
    {
        $this->group = $group;
    }
    
    public function hasRenderer()
    {
    	return true;
    }

}